package com.saihai.jiankang.ufTjjgsfyc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.saihai.common.annotation.Log;
import com.saihai.common.core.controller.BaseController;
import com.saihai.common.core.domain.AjaxResult;
import com.saihai.common.enums.BusinessType;
import com.saihai.jiankang.ufTjjgsfyc.domain.UfTjjgsfyc;
import com.saihai.jiankang.ufTjjgsfyc.service.IUfTjjgsfycService;
import com.saihai.common.utils.poi.ExcelUtil;
import com.saihai.common.core.page.TableDataInfo;

/**
 * 体检异常Controller
 * 
 * @author ruoyi
 * @date 2024-07-31
 */
@RestController
@RequestMapping("/jiankang/ufTjjgsfyc")
public class UfTjjgsfycController extends BaseController
{
    @Autowired
    private IUfTjjgsfycService ufTjjgsfycService;

    /**
     * 查询体检异常列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:list')")
    @GetMapping("/list")
    public TableDataInfo list(UfTjjgsfyc ufTjjgsfyc)
    {
        startPage();
        List<UfTjjgsfyc> list = ufTjjgsfycService.selectUfTjjgsfycList(ufTjjgsfyc);
        return getDataTable(list);
    }

    /**
     * 导出体检异常列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:export')")
    @Log(title = "体检异常", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UfTjjgsfyc ufTjjgsfyc)
    {
        List<UfTjjgsfyc> list = ufTjjgsfycService.selectUfTjjgsfycList(ufTjjgsfyc);
        ExcelUtil<UfTjjgsfyc> util = new ExcelUtil<UfTjjgsfyc>(UfTjjgsfyc.class);
        util.exportExcel(response, list, "体检异常数据");
    }

    /**
     * 获取体检异常详细信息
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ufTjjgsfycService.selectUfTjjgsfycById(id));
    }

    /**
     * 新增体检异常
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:add')")
    @Log(title = "体检异常", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UfTjjgsfyc ufTjjgsfyc)
    {
        return toAjax(ufTjjgsfycService.insertUfTjjgsfyc(ufTjjgsfyc));
    }

    /**
     * 修改体检异常
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:edit')")
    @Log(title = "体检异常", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UfTjjgsfyc ufTjjgsfyc)
    {
        return toAjax(ufTjjgsfycService.updateUfTjjgsfyc(ufTjjgsfyc));
    }

    /**
     * 删除体检异常
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufTjjgsfyc:remove')")
    @Log(title = "体检异常", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ufTjjgsfycService.deleteUfTjjgsfycByIds(ids));
    }
}
